Pigments are dyes that are mainly found in the cell wall of many living organisms and have various functions. A good example is our skin pigment, it protects us from sunlight by tanning us so we don't get sunburn so quickly. A well-known pigment from the plant world is chlorophyll, it is responsible for photosynthesis. But also microorganisms form pigments with far-reaching functions, such as protection from UV radiation or from other microorganisms.
Explanation for children:
Pigments are natural dyes that are mainly found in the cell wall. Each pigment has its own function. For example, many bacteria have pigments that protect them from the sunlight. We have a similar pigment, which is our skin pigment. The more often we sunbathe, the more tanned we become, thus we don't get sunburnt as quickly.