If you are talking about this happening (2-3 gallons of water spewing out) when you just take the cap off the sewer pipe,
and BEFORE you pull open the gate valves to the tanks -- then one of your tank gate valves is probably not closing completely.
It ought to be pretty easy to figure out if it is a gray tank or the black tank valve not closing. If you have more than one gray tank, need to figure out which one.
There could be some debris caught at the outlet that keeps the valve from closing completely. Or it could be a cable problem.
I would put a backflush fitting on you sewer drain outside (like this
http://www.amazon.com/Valterra-F02-4350-Reverse-Flush-Valve/dp/B008O9DV78 or you can find them in RV parts stores )
Backflush from there and see if the blockage/debris clears. You may have to do it several times.
If that doesn't help, you would probably have to take the underbelly down to get to the tank outlet and gate valve closing point. Cable adjustment
might be needed.
The EASIEST solution by far, is to just add another gate valve on the end of your sewer pipe. See:
http://www.amazon.com/Valterra-T58-...&qid=1432344482&sr=8-2&keywords=rv+gate+valve Keep it closed until you take the cap off and
hook up your hose. Then open that additional valve and the leaked 2-3 gallons should come out and into your hose. At that point, you can then open the stock gate valves for the tanks.
K