There are multiple methods for matching grout. Commercially available products will help you produce the shade of grout you're looking for. Alternative methods including using grout colourants after the grout has been laid to change its colour and provide an extra sealant coating. However, you can also mix in acrylic paint to create your own grout colour.
Changing the colour of grout
To change the colour of your grout, the easiest method is to apply an oil-based grout stain developed just for that purpose. There are other grout additive products available as well that are supposed to make the grout stronger and stain-resistant.
However, if you're grouting tiles and wish to change the colour of the grout, you can do so by adding acrylic paint. Use the plain-white grout and mix it according to the manufacturer's directions. Add a bottle of acrylic paint in the colour you want to the grout mixture. The white of the grout will lighten the paint when mixed, so you may need more paint to produce a darker colour. Mix until you have the colour you desire.