Cleaning stained grout can sometimes be a real project because the cement soaks into the block or brick making it difficult if not impossible to remove without destroying the appearance of the product. One way to clean stained grout is to mix muriatic acid with water and scrubbing affected area with a strong bristled brush, if its real stubborn grout simply add more acid to make it stronger. Note that the stronger it is the more it will burn your skin if it gets on you, so be more careful. Thick rubber gloves work well, even gloves for cleaning at walmart work too. If it's not too stained you can use a marginal trowel, or a putty knife to scrape the grout after letting the acid soak into the stain on the brick then brush it aggressively. If you place acid to the wall without priorly placing water on the affected area, the acid can change the appearance of the brick or block making it slightly darker looking. Spray wall with plain water and it will soak into the block, and the acid will concentrate on the grout on the wall instead of soaking in and changing the appearance of the brick or block. If you let the acid run down the wall past the area where you sprayed with water, it can leave run marks on the wall. Spray the acid off that area as soon as possible. Keep the wall below the grout stained area wet so that the acid doesn't affect it. If stains do occur, simply treat it the same way as a stain. Spray with clean water, scrub it with water diluted acid then rinse it off.
TSP (trisodium phosphate) is another formidable heavy-duty cleaning product and can be used to clean masonry surfaces that are going to be left uncoated. TSP does not etch or neutralize the surface alkalinity, so surface testing for pH should be done before coating TSP-cleaned masonry. Due to environmental concerns of phosphate pollution, TSP cannot be legally used in some areas.