TL;DR: In the final episode, Ben explains that he killed Locke because Locke was special, and Ben wasn't.
That really doesn't explain it well, but there are a few other major factors here that need to be considered.
First, is Ben's jealousy of Locke. Until the LOSTies arrived, Ben had been the leader of the Others, and seemed poised to become the next guardian of the island. He supposedly had contact with Jacob, who had been orchestrating everything.
Until we learn that Ben had never actually seen Jacob. Suddenly, Ben's life and mission are in question. At this point in the show, we start seeing slight changes in Ben's attitude towards Locke overall.
Second, is exactly who Ben is really working for.
It is later revealed that Benjamin is actually working for The Man In Black, at least in certain instances. The MiB has a shapeshifting ability, but can only shift into the guise of a person who is dead. In order to splinter the group, the MiB needs one of the core LOSTies dead. Locke and Jack are the two prime candidates as they are seen as the two best leaders.
When Ben hears Locke mention Eloise, he realizes that Locke is more special than he had thought. By this point, Ben is seriously pissed at Jacob. Ben has given up 35 years of his life serving him, only to be supplanted as the favorite by Locke. He's pissed off to the point that Ben later kills Jacob.
Finally, there is also a theory that in order for the return trip to work, a dead body was required as a proxy for the original body of Christian. They needed the original six core group, the proxy-body, and a full plane. Locke's body would technically help fulfill the first two requirements.