A diet high in sugars, coffee or tobacco can stain, age or discolour teeth.

But they’re not the only causes:

Bad dental hygiene, which causes bacterial plaque
Tobacco
Some foods and drinks: tea, coffee, red wine, cola, curry...
Antimicrobial agents: chlorhexidine, stannous fluoride...
Time and ageing teeth