The most common problem with carpets is staining. Most synthetic carpets have some degree of stain resistance--name-brand nylon the most of all.
Immediately following a spill, remove any semi-solid material with a rounded spoon and place a clean, white absorbent material such as paper towels or a kitchen towel over the spot and press to draw the liquid away from the carpet fibers.
The idea is to blot, not to scrub. As soon as towels are wet, replace with dry ones and continue.
Then place dry ones on the spot and weight them down with a heavy object. Again, replace them when they grow wet.
If the stain persists use water and a mild detergent or a carpet spot remover, following the manufacturer's instructions--but first pretest it in an inconspicuous place to avoid damaging the carpet.