The M8 has only a slightly bigger battery than the Moto X and has the same processor and same number of pixels, so wouldn't it only have slightly better battery life than the Moto X? It seems like the Moto X has a thinner software layer as well.
Compared to the Moto X, the M8 has a 13% larger battery, an 8% smaller screen, and an 8% lower clocked CPU (2.3 vs. 2.5 GHz). Those add up to a rather noticeable difference. Also, LCDs (in the M8) use less power than AMOLED screens (in the X) when displaying mostly light colored or white apps and web pages, and most apps and web pages have been trending towards light colors or white the past couple years.