When I read about frontends, it always mentiones webpages. Can it be used in different contexts, e.g. desktop applications?
The term is generic and it tends to be used in n-tiered applications and refers to the UI.
It is not limited to n-tiered applications - in a single tiered application, if you have good separation of layers (say UI, business logic and infrastructure), you would still refer to the UI as the front-end.
So, you can use it whenever you are specifically talking about the UI - the interface that the end user uses.
The term is used both in design and development, including development of desktop software. The term targets a part of a system which is intended to be accessed by a customer or a user.
1. In web development:
It is not unusual to make the difference between:
Note: moderators would be qualified as people outside the company, so controls used by moderators are part of front end.
2. In SOA/SASS:
When services are involved, front end would be everything directly accessible by the users/customers. A desktop application installed by the user and which connects to a bunch of web services would be qualified as front end.
Services themselves, in this context, would be excluded from the front end.
Note: if a web service is the actual product, it may be qualified as a front end. For example, Twilio web service is the front end.
Wikipedia has an article that answers this question directly, front and back ends.
In the context of compilers: