Punctuation is used to group words.
From Why We Punctuate by William Livingston Klein:
The fundamental purpose of punctuation is to use marks to group words.
I. Meaning depends on grouping.
John has gone home.
The meaning of language depends very largely upon the groupings of its words. In very simple language, words are so placed that each word is related to a word or words immediately or closely following or preceding it. In such language the reader is hardly conscious that the words are grouped, except into sentences; and no mark may be required, except the end-mark.
II. Grouping clarifies when there is more than one possible meaning.
The prisoner said the witness was a convicted thief.vs.The prisoner, said the witness, was a convicted thief.
In more complex language the grouping within the sentence becomes manifest to the reader, and two constructions and two meanings of the language often become possible. In order to notify the reader which meaning the language is intended to convey, the writer may use a punctuation mark to flag the point where the meaning may be mistaken. The reader notes the flag and thus keeps on the right line of thought-development.
III. When to use a mark, and what mark to use, are determined by convention or by reason.
In the absence of marks, the relationship between words are either easily mistaken or not quickly understood.
Mr. Smith came to the city in 1985 and moved into the house at 1985 Wabash Avenue. He brought with him 1,985 horses, valued at $198, 500.00.
How does punctuation enable the reader to obtain the meaning at one point in the above sentences, and so to group the language (figures) at another point that he can apprehend the meaning at a glance?
A. Convention
Because of convention (well-nigh universal usage), the above date and street numbers are read nineteen hundred eighty-five.
In the fourth number in our example above we use a comma to do one grouping, and a period to make another (the cents) group. We call the use of the period in this number conventional punctuation.
B. Reason
But the same number in the next sentence is read one thousand nine hundred eighty-five.
As we all know, in arithmetical notation three figures form a group, the groups so formed being named units, thousands, millions, etc. It is therefore evident that, in reading a number containing two or more such groups, the eye will be aided if the groups are indicated by some mark. (We here use the comma and the period for this purpose.) Although the left-hand group of a number may not be full, a figure in that group takes the name of the group, and so we mark it off. Thus we use commas in two of the numbers in our example, one of which (1,985) has only one figure in the second (thousand) group. This we call punctuation by reason, for we thus point off natural groups.
We do not use the comma to group the figures in the same number (1985) used in two other places in the above example. Because date and street numbers of four figures are read in groups of two figures each the eye readily does the grouping, and a mark is not needed as an aid in the grouping. This is also punctuation by reason.
C. Our problem
Our problem is to find a reason for the use of every punctuation mark, and to be ready to point out what seems to us good conventional usage in punctuation for which we can find no reason.