'Smegma, is a combination of exfoliated (shed) epithelial cells, transudated skin oils, and moisture, and can accumulate under the foreskin of males and within the vulva of females. It has a characteristic strong odor. Smegma is common to all mammals, male and female.
Mycobacterium smegmatis is the characteristic bacterium involved in smegma production, and is generally thought to form smegma from epidermal secretions.
The subpreputial moisture keeps the glans moist and may lubricate the movement of the foreskin. However, if allowed to accumulate and decay in the foreskin cavity it can provide an ideal medium for potentially pathogenic bacteria to colonize; current medical opinion is that allowing smegma to accumulate freely is unhealthy. Accumulation of smegma can cause or aggravate a variety of irritations known as balanitis.
Preventing accumulation is best done by rinsing the area with warm water/ need to gently wash away excess with water.
Hope this helped, you may get more information at; http://en.wikipedia.org/wiki/Smegma