The Query tab is used for agents (and smart adornments) only.
The main input box is used for adding or editing a query ($AgentQuery). Pressing the Return key (↩) commits any changes made and runs (or updates) the query. The code box has auto-completion for action code and attribute names (based on using a $-prefix). The code box supports syntax colouring.
From v9.1.0, code fields no longer select the entire text after when gaining focus or after pressing the Return key (↩) to update (save changes). This lessens the chance of accidental deletion of existing code.
The number of items currently matching the query, i.e. the child count of the agent is show at top right.
Priority. This pop-up menu controls whether the agent is 'on' or not. Sets $AgentPriority. See more on controlling agent priority.
Cleanup. This pop-up menu sets the agent's cleanup action ($CleanupAction).
Smart adornments use neither a Priority or Cleanup actions so both these pop-ups are greyed out if a smart adornment is selected.
Note that an agent's query, action and priority can also be set from the agent tab of the Get Info pop-over.