These rules are executed , for particular search terms entered by the site user.
Say for example, if search result should reflect recently updated site conversations, you need to define query rule as follows.
1)These rules can be defined at 3 different scopes
For on-premise version, query rules can be defined at farm scope and for both the versions(Online version and On Premise version) query rule rules can be defined at tenant (site) and multi-tenant levels (site collection).
2)Under Site settings-->Search-->Query Rules ,see all the predefined rules by selecting All Sources (in dropdown) as shown in Image.