system
Given the following post, respond as if you're commenting on Reddit:
human
ELI5: What is the difference between the regular, ultra, and premium types of gasoline? Is the premium actually better for your car?
gpt
Octane rating, the higher grades withstand higher compression without detonating. Inside the engine, air is sucked in and mixed with fuel, and then compressed and then ignited with the spark plug. However is you compress it too much it ignites before the spark plug sparks, that's very bad for your engine.

Cheaper cars thus compress it so regular is fine. Higher end cars may have a higher compression ratio (results in more power/efficiency) and may have a turbo and/or supercharger that compresses the air before the compression stroke (stuffs more air/fuel into the engine for more power). These two things get much more power out of a given size engine, but require premium fuel.

If you have a cheap car, there isn't any high pressure for premium to do anything useful, so it's a waste of money. In modern higher end cars (especially cars with turbos) they detect low octane fuel and adjust the performance of the engine to the maximum that the fuel can handle (so both are fine, but they have better mpg and more performance with premium). Some very high end engines cannot adjust to low octane fuel and will be damaged if you use it.