Both can be represented by a collection of objects and actions. Ideally there is a close match between the two. This hierarchy is understandable to the user. One is taught to write reports in a particular top down way that reflects this. Internally the computer represents the document in some way that reflects this hierachy.
Words are white space separated strings of characters.
Sentences are sequnces of words terminated by periods. Paragraphs are sequences of sentences. A particular wordprocessing program, or document preparation system has to choose how to manipulate these objects of interest. These commands and the rules combining them go to make up the syntax of the task. Many documents found on the web are prepared in HTML format.