Cock and Ball Torture (often abbreviated CBT, an acronym it shares most amusingly with "computer-based training") is a common process in BDSM play in which the bottom or submissive partner, equipped with male genitalia, has painful things done to said genitals.
There are many different methods and degrees of torturing the male genitalia. Perhaps the least involved (and most common) would be simple slapping or flagellation of the penis or scrotum. This has the added advantage of sensitizing the area, whether for the purpose of sex or for further stages of CBT. Another common method is the compression of the testicles through various methods. A common one is to press them between two boards which are gradually brought closer together through the use of some sort of threaded hardware. The testicles can (without permanent harm) be compressed to nearly pancake thinness in this manner.
A similar activity, simply stepping on one's cock and/or balls, has similar effects. This seems to be fairly common in male-male homosexual pornography, especially while wearing combat boots or similar footwear. Some people enjoy (at some level) simply enjoy being punched, kicked or kneed in the equipment.
Other possibilities include ball stretching (just what it sounds like), perhaps via the suspension of a parachute from the testicles, a generally conical apron of some semi-rigid material (typically leather) from which weights may often be suspended. One can also do rope bondage in miniature (or perhaps not-so-miniature) in order to constrict the penis as it becomes engorged. This tends to produce a slightly painful and extremely frustrating state in which the penis cannot become fully hard, but often continually tries to anyway.
In the most extreme end of this phenomenon we have activities like stretching out the scrotum and nailing it to a board. It should be immediately obvious to even the most educationally challenged individual that this is an extremely dangerous activity for a number of reasons, and should not be attempted lightly. (I know you're thinking, "And he needs to tell people not to take nailing their scrotum to a board lightly?" And the answer is yes, some people will.) However, many people also practice cutting and temporary piercing of the penis on a semi-regular basis. Given proper care for sterility (And I'm not just pointing out you shouldn't let the knife slip too far) and possible biohazards, this is a relatively safe (Though potentially very painful) method of play.
It is worth mentioning that any of these activities are potentially dangerous, some of them more than others. For instance, it is actually possible to tear the scrotum off with one's hands if pressure is applied in the right (wrong) way. Also, rapidly crushing a testicle can permanently damage it. Rupturing the scrotum or a testicle can result in the permanent loss of both testes. On the other hand, I know someone who ran into a curb and left one testicle hanging on the neck of his bicycle, and still went on to use the other one to father a child.
I won't go far into justifications for this kind of behavior; None are needed. The genitals of either sex are an extremely sensitive region; physically, emotionally, and culturally. Naturally this leads to people involving them in their BDSM play as they involve them in other facets of their lives.