It's not a building or specific mechanic, it's simply a term used to describe a world utilized to generate diamonds.
There are 17 worlds. You could (using the same account) open up a new city in each world. You have a single diamond balance shared across every world. So if you spend in one world your diamond balance is reduced in every world you operate.
The idea of a Diamond Farm is you set up any method of diamond generation you can and instead of spending on that world, you save all those diamonds for use on your main world
Main methods utilised:
(1) Wishing Wells: Fill the entire city with wishing wells. You get these during events
(2) Guild Expedition: Complete Guild Expedition each week to earn diamonds
There are other options but those are the main two. PvP arena is an option if you want to explore that route. You don't need any huge amount of resources, just to complete the free attempts whenever and then every so often you *might* get diamonds from it if you rank high enough