That: Should be utilized restrictively to narrow a category or determine a specific item being discussed.

Example: -This may be the house that Jack built.

-There are a lot of grammar mistakes that produce you look bad.

Which: Should be used non-restrictively. Not to narrow a class or identify a specific item but to include something about something already identified. Almost always preceded by a comma, a parenthesis, or a dash.

Example: -This is the house that Jack built, which he later on sold.

-Jill received an excellent grade on her behalf paper, which she desperately had a need to pass the class.

Exception: Which  ought to be used restrictively only when it is preceded by a

Example: -The room where he ate his dinner.