I had the impression that "front end" refers to the user interface in most cases, but occasionally people also refer to "the front end of a compiler". So what is the difference between these two terms?
Front end only implies there is also a back end that kicks in after the front end in some sort of transaction. In a web dominated world it typically means UI vs logic with the logic being on a central site. But basically it is about a separation in implementation and order/sequence.
No they are not the same. "Front end" is a superset of "User interface."
In a distributed service-oriented environment, a server run by one company may need to send transaction requests and receive responses from the server run by another company. The second company exposes its functionality via services (RESTful, WCF, whatever), which comprise its front end. In this scenario, there is a front end, but no user interface; there is only the service interface.
I would consider a front end a collection of possible user interfaces. I would also consider my front end any part of my program not on my server because that is my back end.