Beating your head and chest is an expression of grief amongst Shi'ite Muslims, for instance on Ashura, the Holy Day where they mark they martyrdom of Ali (the man the believe to be the true Caliph) they spend the day beating their heads and chests and gashing their heads with swords.
Sunnis more commonly beat their chests (for instance watch a Muslim funeral some time and watch what the women in particular are doing) to express grief. I'm almost 100% certain the mosque in the picture was Shi'ite.
- SEAGOON