The bottom bracket (BB) is the spindle or bearing assembly which sits in the bottom shell of the bike frame to which the chainset is attached and allows it to spin freely. Older versions are a spindle which goes through the frame and sits in a bearing race and the chainset attaches to this but modern versions are an outboard bearing assembly which the chainset with spindle attached passes through and a left hand crank attaches on the other side. There are many variations within the above two types of bottom bracket so you must ensure that your BB and chainset are compatible.
Spindle type bottom brackets come in several types; square taper, ISIS and Octalink and are only compatible with crank arms from a corresponding system. Shell width is the next important factor in these types and luckily there are only three sizes; 68mm (English thread road and mountain bike), 70mm (Italian thread road) and 73mm (English thread mountain bike). After that the actual spindle length you require is determined by the width of your chainset so a double road will need a shorter one than a mountain bike triple.
Outboard cup type bottom brackets do away with a lot of the above needs as they are simply a set of bearings cups so the main thing you have to concentrate on is whether you have an English or Italian threaded frame. The major benefits of outboard cups are the ease of fitting and more importantly the ease at which the chainset can be removed for servicing or swapping out. It is also easier to get aftermarket outboard cups with improved bearings as several companies now produce ceramic bearing versions.
The newest bottom bracket system to the market is BB30 which uses an oversize bottom bracket shell where special bearing cups are simply pushed into the frame without any threading needed and the torque of the crank arms on the chainset keeps everything in place.