Rules for formal writing are quite strict, though often unstated. Formal writing is used in academic and scientific settings whenever you want to convey your ideas to a wide audience, with many possible backgrounds and assumptions. Unlike casual conversation or emails to friends, formal writing needs to be clear, unambiguous, literal, and well structured.
Here is a great article to read for improving writing skills and learning how to use the right guidelines, format, and transitions. There are tips and examples throughout the article as well to help writers from getting stuck!