I've seen them 'cog cleaning' tools in a bike shop. Just a long thin brush, but personally not worth the $$. I still use the good old tooth brush for all of that stuff. I remove the cog intact, and then with soap and water and a brush give it a scrub down. That usually gets all the grime off. But if you want your cog to look like new again, I recommend soaking in some degreaser for about 5 - 10min.
I actually see no point to cleaning the rear cogs besides the fact that the chain might run that extra bit smoother and it makes the cog look newer and cleaner...