Straight from:
http://www.ibsf.info/rules-snooker.shtml#3_11
The rule for end of frame:
4. End of Frame, Game or Match
(a) When only the Black is left, the first score or foul ends the frame excepting only if the following conditions both apply:
(i) the scores are then equal, and
(ii)...