Too Much Water
Mix the grout mortar exactly as described by the manufacturer. Often the cause of incorrect grout colors is simply too much water.
Along with mixing the grout as expressed on the packaging, avoid using too much water to mop up excess grout. When applying grout, excess grout will likely cover the surface of the tiles.
You will then need to use a damp mop to wipe up this excess. If you use excessive water on the sponge, this can dilute the tile and affect the color.
Instead, wring out the sponge thoroughly before continuing.
Sometimes grout will appear to be drying in different colors if it was prepared at different times. Grout works best when it is freshly prepared, so commonly tile installers will only mix enough grout to be used within an hour's time frame.
Once one area is covered, more grout will be mixed to complete the next section. In this case, the difference in color could be an illusion caused by the gap in time.
Once the entire surface has dried, assess the color. If grout is still different colors, this could be a problem with the grout mortar.
Problems With Grout
If the surface is entirely dry and the right amount of water is used, but the grout is still drying in different colors, this could be a problem with the grout itself. In this case, stop using it before covering the entire area so you have less to remove.
Return the grout to the store or contact the manufacturer's customer service line for information on getting refunded for your purchase or replacing the defective product.
Removing Dry Grout
Once the grout has dried, you'll need to remove it if there is color variation, which is often a difficult and messy process. Use a carbide blade or rotary tool to beak up dried grout, taking care not to damage the actual tile.
Scrape away any remaining grout with a chisel, and sweep up dust thoroughly before replacing with new grout.