Now - I've not played this game myself, but have played several D&D games
Firstly:
The "1D8" - this means 1 roll with a dice that can result in numbers 1 to 8 (8 sided dice).
Likewise 2D4 would be 2 rolls with a 4 sided dice which will result in a number between 1 and 4. (with a total result ranging between 2 and 8)
A roll with a standard 6 sided dice would thus be mentioned as 1D6.
The "To Hit" number is added to your "To hit" roll, to test if you actually hit with the weapon.
The damage number is added to your damage when you have hit the enemy.
So first - you roll an attack roll with a 20 sided dice, yielding a result between 1 to 20.
Then your to-hit modificers are added, wether they be from your character statistics (strenght for meele weapons) or the weapon (bonus "to hit", for instance the +3 and +4).
The total of your attack roll is then compared with the Armour Class of your opponent. If you hit, another roll is made to calculate the damage of your blow.
As for which weapon does most damage of the two you listed:
1D8+4 equals damage ranging from 5 to 12 whereas your 1D12+3 gives 4 to 15. (There will likely be added damage to both of these from your strenght modifier.)
So you shouldn't only think of damage per hit, but also how often you will hit. It dosen't matter you yeild the most powerfull weapon in the world, if you can't hit your enemy. But you also should take into account if you wish a higher base damage or you wish to do the potentially most damage.
Such desecions are often very subjective - but personally - I prefere to go with highest possible "to-hit" and highest possible base damage.
Hope this helps a little.