The process is the same as building a normal grinder if you do it in the Nether.
To construct a farm in the Nether, build platforms for Zombie Pigmen to spawn on, with trapdoors on the edge, and place Slabs on the floors of all surrounding areas (or just fill them in) so Pigmen only spawn on your platforms. You can then use Lava flows to collect the Zombie Pigmen into a central area.
You can build one in the overworld out of portals, as detailed on the wikithe wiki:
To build a farm in the Overworld, construct a rectangular prism of interlocking Nether Portals (to save Obsidian) and put open Trapdoors on the edges of the two bottom Obsidian blocks so that the Zombie Pigmen walk off. From here, you can use Water to collect the Zombie Pigmen into a fall or suffocation trap.