Bore size - gauge (or possibly calibre)
As with all gun terminology the categorising system for shotguns is rooted in its history and shows its age. The '12' in 12 bore is not as you might expect a unit of length but a division of weight.
The 12 refers to a 12th of 1 pound of lead or more specifically a pound of lead can be turned into twelve balls of equal size that equate to the barrel diameter of what we know as a 12-bore (0.729").
This also explains why a 20 bore is smaller - i.e. the pound of lead divided into 20 pieces.
In an attempt to clarify - during the period of shotgun development cannons were firing rounds distinguished by their weight 1,4 or 8 pounders for example, balls and the most common units of measure was a Dozen (12) therefore the logic of dividing a one pound ball into one dozen pieces follows.
This system goes back to the time of muzzle loaders when those with a gun had to force the single ball of shot down the end of the barrel.
It is worth considering the purpose of the barrel when looking at bores. The barrel must contain the expanding gas pressure from the detonation whilst it builds to expel the projectile in the desired direction. Muzzleloaders were of far greater length (average 42") than most modern shotguns due to the slower burning time of black powder which subsequently took longer to expel the shot.
Modern Nito Powders are generally at full pressure and therefore the shot is at maximum velocity at 9" to 12" form the breech.
Due to the slower burning black powder muzzleloaders had longer barrels (42") allowing more distance for the projectile to build up speed, where modern nitro powder the shot is at its maximum velocity 9" from the muzzle.
In modern shotguns the bore diameter is only the central section of the barrel, the chamber is wider to allow for cartridges and these are joined by the "forcing cones". At the end of the barrels sit chokes which define the shots exit from the barrels.