What happens to mail as it arrives: filing, flagging, categorising.
Rules compile to one Sieve script the server runs on delivery, so they apply on every device, whether or not this one is open. A rule is conditions matched all or any, then actions: file into a folder, mark, categorise, or discard — and optionally stop testing the rest.
A category names what a message is — it shows as a chip in the list and as a filter. A rule with Categorise as sets one on delivery; the AI only looks at mail no rule has categorised, so your rules always win.