Your teeth can become discoloured by stains on the surface or by changes inside the tooth. There are three main types of tooth discolouration: extrinsic, intrinsic and age-related.
Extrinsic discolouration occurs when the outer layer of the tooth, or the enamel, is stained. Coffee, wine, soda or other drinks or foods can stain teeth. Smoking also causes extrinsic stains.
Intrinsic discolouration is when the inner structure of the tooth, or the dentin, darkens or gets a yellow tint. You can get this type of discolouration for different reasons, but it's not really food-related.
Age-related discolouration is, well, just as it sounds. It's a combination of extrinsic and intrinsic causes working together. The enamel covering the teeth becomes thinner as you get older, which allows the dentin to show through.