Will McCants (Brookings) explains the motivation of both Sunni and Shi‘a fighters drawn to the Levant battlefield by a common apocalyptic belief:
They fight in the vanguard of the Mahdi, the Muslim savior whom the Prophet Muhammad prophesied would appear in the Levant (the coastal Mediterranean region that includes Syria and Lebanon) at the End of Days to wage a final great battle against the infidels’ armies.

(Later) With the entry of the United States into the field, jihadis anticipate that the ultimate showdown in Dabiq is drawing ever closer. One might expect that the recent entry of infidel armies into Iraq and Syria would lessen the internecine tone of the prophesying and focus attention on the Mahdi’s battle with the infidels. But it has only heightened the sectarian apocalyptic fervor as each sect vies to destroy the other for the privilege of destroying the infidels.
Link:http://www.lawfareblog.com/2014/10/t...an-apocalypse/

I have heard Muslims explain this, but Will's explanation is best.