"Should I use which instead of that?"

The English words which and that can be used as relative pronouns, which means they introduce relative clauses. A relative clause (sometimes called an "adjective clause") modifies a noun in a sentence like an adjective except that in English almost all adjectives come before nouns but relative clauses always follow the nouns they modify. An example of a relative clause is that was for sale in the sentence The car that was for sale was parked on the side. The relative clause here modifies the car and tells us which car, among two or more, we mean.

There are two main types of relative clauses based on their function: restrictive and non-restrictive relative clauses. Restrictive relative clauses are like the one in the example given above; they "restrict" the reference of the noun they modify. That is, in the above sentence the relative clause that was for sale restricts the reference of the car; it tells us that we're not talking about some other car that may have been mentioned before, but specifically the car that was for sale--that was the one parked on the side.

Non-restrictive relative clauses are ones that are not essential to the meaning of the sentence. That is, they can be left out without changing the basic meaning of the sentence since really all they do is provide extra information. For example, in the sentence The car, which had out-of-state license plates, was going very fast, the relative clause which had out-of-state license plates is a non-restrictive relative clause. It provides additional information about the car; we already know from the context which car we're talking about, and the real point of the sentence is to say that this car was going very fast.

These examples illustrate another difference between restrictive and non-restrictive relative clauses. Notice that the relative pronoun is that in the restrictive one and which in the non-restrictive one. This is a widely-followed rule: that is used to refer to things in restrictive clauses and which is used in non-restrictive relative clauses. But many English speakers might think that the car which was for sale sounds a little "better" because it seems more formal, and many authorities on usage would find nothing wrong with the car which was for sale. However, other "experts" on grammar would maintain that you must always use that in restrictive and which in non-restrictive relative clauses (that modify nouns referring to things) and to do otherwise is "wrong." So because there are many speakers of English who adhere to the latter rule, it can't hurt to try to follow it.