Also known as restrictive and non-restrictive clauses. Many people aren’t even aware of the differences, but there are. Take a look at this example:
Wood that is strong generally makes a good material to build furniture. (Restrictive)
The use of “that” restricts the sentence to the kind of wood you’re discussing. In this case, it’s only strong wood.
Wood, which is strong, generally makes a good material to build furniture. (Non-restrictive)
The second infers that all wood is strong. If you were to remove the “which is strong,” the meaning of the sentence would not be affected dramatically. Think of it as extra information. Whether or not the which part of the sentence can be removed without affecting the sentence meaning is one of the easiest ways to remember the difference between the two.
Commas precede a non-restrictive clause (as above). Commas do not precede restrictive clauses, as the additional information in a restrictive clause is essential to the meaning.
Remember, “that” defines and “which” informs.
Here’s another example:
I knocked on the first door that was black. (Restrictive)
In this, the sentence is restricted to only black doors. There may have been many doors of different colors, but I knocked on the first black door I saw. Written another way, “I knocked on the first black door.”
I knocked on the first door, which was black. (Non-restrictive)
In this sentence however, the colour of the door is not important. I could write the sentence as “I knocked on the first door. It was black.”
This is as what’s important here is that the door I knocked on was the first I saw. The color is just an additional piece of information.
Here’s a further example, this time from Strunk & White in The Elements of Style:
The lawn mower that is broken is in the garage. (Restrictive)
Here I’m referring to the location of the broken lawn mower.
The lawn mower, which is broken, is in the garage. (Non-restrictive)
Here I’m referring to the location of the lawn mower. It happens to be broken.