You can use a RAMPS board on a MEGA but the version of GRBL you need is quite specific to match the MEGA.
The development of GRBL for the MEGA has been limited a little as they move to more exotic boards such as STM.
Finding the one for the MEGA took me a lot of failed attempts and multiple downloads till I found a suitable copy and I cannot remember where I got it.
Google "grbl arduino mega" and work your way down the list.
Done forget to rename the with version or similar then you don't get them mixed up.
Sorry that's the best I have for the mega advice.