Commercial cleaners
There are a lot of tile cleaners, even some grout cleaners on the market such as those shown above or the newer cleaner specifically for grout, Oxy-Grout. They work pretty well if you have a stain on grout that had been sealed before the stain, because the stain will be somewhat just in the surface. If the stain has penetrated a sealer, you need to use a wax-wash first to remove the sealer and allow the product to penetrate. Professional services use sulfuric acid as a cleaning agent for grout.
DIY formula
One of my radio listeners swears by the following cleaning formula - applied with a spray bottle and then scrubbed in:
1-3/4 cup water
2 Tbs Baking Soda
1 Tbs Vinegar
2 Tbs Amonia
If you are going to have to scrub harder, protect the tile itself by cutting down your scrub brush so that there are only bristles hitting the grout, not the tiles, or use a toothbrush.
Most tile installers admit that grout just gets dirty and will push you to use grout that is light grey, the same colour as dirty grout! That saves a lot of cleaning. Epoxy grout resists stains better because it does not absorb liquids (but is a lot more cost and trouble to install -- generally used on counter-tops) .
and when that doesn't work....
When none of these products will get the stain or old dirtiness out, then you can try scraping the surface with a grout removal tool. If it gets clean without removing much grout, simply re-seal with some more silicone to keep it clean.
If the stain is deep down, remove all the grout, re-grout, and this time get that sealer on right away: click here for links to grout removal tools.