All av-gas had about 18700 BTUs per gallon. The higher octane fuel resisted detonation better allowing for more pressure in supercharging and/or higher compression in the cylinder.
To use Tomo's illustration the Merlin used 2.25 liter cylinders so at best without a supercharger you could get 2.25 liters of fuel/air mixture to burn every two engine revolutions (and only a few racing car/motorcycles get 100% filling of the cylinder/s).
A supercharged engine using 6lbs of boost (normal air pressure being 14.7lb) can get 40% more fuel/air into the cylinder. An engine using 12lbs of boost can get 30% more fuel/air into the cylinder than the 6lb boost engine can. The problem comes in with th efact that trying to use 12lbs boost will heat the fuel/air in the supercharger ( very few, if any, engines had fuel detonate inside the supercharger due to heat) is when the hot mixture is compressed in the cylinder by the rising piston and the temperature rises ( and you have the hot cylinder parts, like exhaust valve/s) the mixture can start burning before the spark plugs fire OR the entire cylinder full of mixture flashes (ignites) at once, Normally it takes about 40 degrees of crankshaft rotation to burn the mixture depending on engine. Spark plugs fire at around 20 degrees before top dead center and burning is pretty much done at around 20 degrees after top dead center. The Flame front advances across the cylinder (piston top). Now the advancing flame front also exerts a pressure wave that further compresses the fuel/air mixture and even if the remaining mixture (last 1/2 say) flashes (detonates) it exerts very high stresses on the engine and can melt holes in the piston top. Having the mixture flash before the spark plugs fire really stress the engine because it can make the engine (or that cylinder) try to run backwards even if it doesn't blow things apart ( one cylinder trying to run backwards can result in bent broken con rods, broken pistons,etc)
High octane is ALL about increasing the auto ignition temperature of the fuel. It allows the use of higher compression ratios in the cylinder which allow more power to obtained from burning the same amount of fuel.