Coloured filters have been used for black and white photography since the very early days, though their use would only have become widespread after the introduction of panchromatic films.
Their function is to alter the tonal representation of colours in a scene by reducing the light transmission of some colours. For instance; Visualise a red ball on the grass, photographed on a normal black and white film. In this situation the shades of grey could easily be the same for both, but if a red filter is placed over the lens, the green light entering from the grass is greatly reduced. An extra amount of exposure is given to allow the green areas to record on the film, which causes the red ball to appear overexposed because the red light was not retarded. This effect is usually described as; Filters lighten their own colour and darken their opposite. Keeping this phrase in mind will help you understand when a filter is appropriate.