Quote:
"Rigor normally appears within the body around two hours after the deceased has passed away with - as we have already mentioned - the facial and upper neck and shoulder muscles first to visibly suffer from its effects. Many Scenes of Crime Officers (SOCO) have reported that upon discovering the deceased that their face might have taken on what looks to be a grimace; this is because the facial muscles have contracted as ATP (Adenosine Triphosphate) drains from them"
Source:
http://www.exploreforensics.co.uk/rigor-mortis-and-lividity.html
So it's a normal sign of rigor mortis (and most definitely occurs
after death, rather than before it). Some dead bodies won't exhibit the 'grin' simply because rigor mortis hasn't yet set in. With others the position of the body after death (such as lying face down) might mean that ATP doesn't drain away from the muscles.