Bees use brushes on their midlegs to clean off pollen and dirt from their forelegs by pulling their forelegs between their midlegs.
The last large segment on the middle leg of the bee is known as the midleg basitarsus and it often contains a brush made of hairs. This brush can be used for grooming as the bee forages. The brush cleans off the forelegs as the bee flexes, pulling the foreleg between the basitarsus and the femur to trap pollen and dirt.
The hairs making up the brush can be different lengths, straight, bent or even hooked. Notice the differences in the brushes of the bees above.
This information is also available from the University of Calgary Invertebrate collection, where it was curated as part of a study on design inspired by bees.