Generated scripts (for example, those produced by saving a platform script) are automatically formatted with tabs and returns in appropriate places, but you can reformat a script by selecting Edit > Reformat Script.
The reformatting is based on the width of the window. If you reformat a script and don't get the results you want, try resizing the window.
Reformatting is undoable (Edit > Undo).
The Reformat command alerts you if the script is badly formed (for example, if parentheses are not matched).