Location based gamerules on Minecraft Realm (1.14.4)
It is possible for you to turn on /gamerule keepInventory true
in the Nether, you must go there first before entering the command and it should, in theory, only apply that gamerule to the Nether, similarly with the End.
If you're working with Vanilla, there is no basic solution to having mob griefing off in a specific area. You can try looking for some command block commands online which may have a solution, that's if you're looking to use those. This might be what you're looking for: https://www.minecraftforum.net/forums/minecraft-java-edition/redstone-discussion-and/commands-command-blocks-and/2825763-how-to-disable-creeper-griefing-in-a-certain