When you press Enter, the new line might automatically indent to the same level as the line above. This is controlled by the Indent new lines like previous option on the Code Editor tab of the Options dialog.
If you highlight one or more lines in the query and press Tab, those lines are indented one level. If you press Shift+Tab, the highlighted lines are unindented by one level.
This indentation of lines only applies if the selected text includes a line feed character. For example, you must either select at least part of two lines or if selecting only one line, the cursor must be at the beginning of the next line.
If no line end is included in the selected text, or no text is selected, a tab character is simply inserted.
To indent or un-indent a line without selecting it, press Ctrl+I or Shift+Ctrl+I, respectively.