The joints are first deep cleaned to remove grease, soap and loose dirt, because the colour sealant must bond to the grout itself. Any small cracks are filled. The stain is then applied with a fine brush along each joint and the excess wiped off the tiles before it sets.
Once cured, the colour sealant resists water and stains, so the new colour stays even. It works on sound cementitious grout. Epoxy grout does not need it, and crumbling grout needs regrouting first.
If you only need part of the room to match the rest, grout colour matching may suit better. For showers that keep staining, consider epoxy grout for high-moisture areas.