Basically, once the ball leaves the passer's hands, a grab of the jersey will be pass interference if the ball is thrown to that receiver. If it occurs before the ball leaves the passer's hands, it will be holding.
There's an interesting aspect to this distinction. There can be no pass interference on a play where the ball was uncatchable. There is no such exception for holding. So if you grab a player's jersey after the passer has thrown the ball, it might be no penalty at all if the ball was uncatchable. However, if you do the same thing before the passer throws the ball, it can be holding, even if the ball was uncatachable (and even if the ball was thrown to a player on the other side of the field).
Note that most referrees don't really apply the "leaving the passer's hands" rule that closely. Most of the officials in position to call holding v. pass interference are not (and cannot possibly) be looking at the quarterback. So they use some common sense. If the illegal contact or holding occurs and the ball doesn't show up for a second or two, they will almost always call it a hold, not pass interference. So, on a 40 yard pass, the ball can be 10 yards out of the passer's hands, and it still will usually be called holding. PI is generally reserved for situations where the contact occurs while the receiver is in the process of trying to catch, or getting ready to try to catch, the ball, and everything before that is usually called holding, even though frequently the ball has indeed left that passer's hand.
As others have noted, you also can't commit pass interference behind the line -- like a shovel or screen pass. That makes sense since PI is a spot foul anyway. Contact behind the line of scrimmage on a receiver is fine, unless it's holding or otherwise some other penalty (e.g., hands to the face, unnecessary roughness, tripping, etc.)