Good start would be reading this
what they ideally want is Western troops on Syrian soil, best recruiting tool they could have. Killing other muslims isn't as easy a sell.
It's very much about religion, ISIS are extreme Sunni. Iran are Shia.
It's also nicely coinciding with the Saudi move on Qatar (which is backed by Iran). Lots of proxy wars going on here.