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 external 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. Bottom bracket frame shell width is the next important factor in these types and luckily there are only two sizes; 68mm and 73mm. 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.
External 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 compatibility with your current chainset. 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 replacement. It is also easier to get aftermarket external 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.