Word groups describing nouns or pronouns (adjective clauses, adjective phrases, and appositives) are either restrictive or nonrestrictive.
Restrictive elements
A restrictive element defines or limits the meaning of the word it modifies and is therefore essential to the meaning of the sentence. Because it contains essential information, a restrictive element is not set off with commas.
If you remove a restrictive element from a sentence, the meaning changes significantly, becoming more general than you intended. The children don’t need clothes in general. The intended meaning is more limited—they need washable clothes. And the bank serves all kinds of home buyers, but mainly those who have never had a mortgage.
Nonrestrictive elements
A nonrestrictive element describes a noun or pronoun whose meaning has already been clearly defined or limited. Because it contains nonessential or parenthetical information, a nonrestrictive element is set off with commas.
If you remove a nonrestrictive element from a sentence, the meaning does not change dramatically. Some meaning is lost, to be sure, but the defining characteristics of the person or thing described remain the same as before.
The children need sturdy shoes, and these happen to be expensive. The meaning in the second example is already restricted to a subset of all home buyers; the clause on the end does not restrict the meaning further.
Exercises:
Major uses of the comma 1
Major uses of the comma 2
All uses of the comma
Related topics:
Distinguishing between restrictive and nonrestrictive from context
Commas with adjective clauses
Commas with adjective phrases
Commas with appositives