Best thing I find is to take an existing one and copy it, creating a new file. Rename the file to your_ship_name.variant, and then work with that as a basis.
You should open it using your favourite text editor. Something like
Notepad ++ or
SciTE do me okay. They are like normal text editors (e.g. notepad) but allow for dynamic formatting of code. It makes it much easier to comprehend the files, and subsequently edit it.
If you use the Example 2 mod files, as provided by Alex in the previous link, then use that as a basis, editing the ship files contained within (based around the addition of a Red Tempest) that should give you a flavour of what is going on.
e.g. a part of the code of the ex2_red_tempest.ship file reads like this:
{
"angle": 260,
"arc": 235,
"id": "WS 002",
"locations": [
-4,
-17
],
"mount": "TURRET",
"size": "MEDIUM",
"type": "ENERGY"
},This is referring to the weapon mount WS002, it has a stated angle (direction the gun points by default), a coverage arc, and id, a location (see the link to Trylobots thread for more info on these coordinates) and it is a medium sized energy turret. Fomratting, commas, semicolons, bracket types and locations etc. are very important in these types of files, so try and stay consistent.
If you look in the corresponding ex2_red_tempest_Attack.variant file, you can see what weapon is assigned to the Attack variant of the Red Tempest to weapon slot WS002. It will probably be a graviton beam or a pulse laser, but it could feasibly be a mining blaster, or a heavy burst laser or something. Note the weapon is given it's 'code' as dictated in the weapon data, so there might be a bit of cross-referencing needed, e.g. to discern what the ID for an IR Pulse Laser is, but with a bit of digging it should all become clearer and clearer ...