5 gallons is small, but if you're an expert fishkeeper and can handle nano marines, then a small group of BBGs shouldn't be hard. Bear in mind they may not move about much but they sure are territorial for their size!
There's no optimal specific gravity. They can live perfectly well in freshwater, some species even in soft, acidic water! But they're easier to keep in slightly brackish conditions; say, around SG 1.002 or 1.003. Under such conditions you'd be easily able to add a few plants as well, particularly Java moss, which works extremely well in nano tanks if combined with an attractive layout of rocks. It grows slowly, but steadily, and builds up into a complex reef-like structure that makes lots of nice hiding places for small fish.
Larger shrimps and most of the nerites would work in such a tank too, so you'd be creating what's basically a freshwater reef tank. I've got an 8-gallon system like this for cherry shrimps and rice fish, and though it's small and requires minimal upkeep, it's one of the funnest tanks I've ever made, with lots to watch. Baby fish, swarms of shrimps, and various small snails all move about doing their thing in the huge clump of Java moss.
Cheers, Neale