None of them seems entirely correct. The effects should differ somewhat between melee and ranged weapons, though, so it's going to be kind of difficult to implement something exact in
BG2. According to the "Combat & Tactics" book, the effects are as follow for melee attacks:
Specialization: +1 to hit, +2 damage, +½ attack
Mastery: +3 to hit, +3 damage. +½ attack (total effect)
High Mastery: +3 hit, +3 damage, +½ attack, weapon speed up by one category, crit rate improved
Grand Mastery: +3 hit, +3 damage, +
1½ attack (if I interpret the section right, see below), weapon speed up by one category, crit rate improved, weapon dice size improved by one.
The "weapon dice improved" probably can't be done, but it can be simulated by another +1 to damage (average for most weapons, and there aren't many weapons with d12 damage anyway).
So, something like this:
HIT DAMAGE SPEED
0 0 0 0
1 0 0 0
2 1 2 0
3 3 3 0
4 3 3 -3
5 3 4 -3
That's assuming you actually have +½
APR at 2 and +1½ at 5; if not, the damage should probably be adjusted to make up for any extra or missing attacks. I'm not sure if -3 to speed matches "improve by one category", either.
Pretty much, the
BG1 version appears closest, the
BG2 ones seem rather nerfed. (Then again, the book states that a character should only be able to specialize in ONE weapon, so nerfing it in exchange for offering specialization in multiple weapons could also be seen as balanced.)
...hell, I no longer have any idea where I'm going with this post. Just interpret it however you want.