If you put commas before and after your "which phrase", it means the info put in "which phrase" is not necessary, and it just gives the readers some extra info...
Ex: "That tree, which is the tallest in the area, belongs to my grandpa" (not necessary)
Ex: "Let's have a photo of that tree which is the longest in the area." (necessary)
At times using commas may result in a change in meaning:
Ex: "The eggs which were rotten were thrown into the bin." (Just the "rotten" ones)
Ex: "The eggs, which were rotten, were thrown into the bin." (This means all of the eggs were rotten)
Hope this works...