Learning new proficiencies or fighting styles is fairly easy for any class to do, and training with a new weapon may be undertaken at any time. In general, training yourself to use a new weapon (so long as you have an open proficiency slot available) takes 6 months, minus 1 month for every point of Intelligence you possess over 14 (to a minimum of 1 month). If you have a trainer to teach you (and a slot available), training with a new weapon only ever takes 1 month. Warriors can gain a proficiency by spending a slot at any time, even if they haven't trained with the weapon before.
Training with a new weapon when you do not have a proficiency slot available takes significantly longer - self-training will take 1 year, minus 1 month for every point of Intelligence possessed by the fighter above 10 (to a minimum of 4 months). Even with a trainer, it will take 3 months.
Single-classed pure fighters who have not yet specialised in a weapon may choose to do so. In order to specialise in a weapon, you must use it very frequently - though it does not have to be your primary weapon. You can only ever specialise in one weapon, and you may only begin training to specialise in a weapon if you have a proficiency slot free to spend on it. Specialisation does not require you to be trained by someone who is specialised in the weapon in question, though it helps. If you are trained by someone who is specialised, training takes 2 months. Otherwise, self-training takes 1 year, minus 1 month for every point of Intelligence possessed by the fighter above 10 (to a minimum of 4 months).
The benefits of specialisation are outlined in the player's handbook.
Those who are specialised in a ranged weapon may suffer a -4 penalty to-hit in order to fire into an engagement without a risk of harming allies as long as the engagement is not being fought at closer-quarters than a short sword. For example, this would be possible for two warriors dueling with blades, but not for two men grappling, two thieves fighting with daggers or a warrior fighting a giant spider. When in doubt, the DM's adjudication should be called for. On a roll of a natural 1, the archer should reroll their shot as if made against one of their allies in the engagement.
Specialisation in a weapon is not the absolute high point of proficiency with a weapon that a fighter can attain. There is a rank above this: mastery of the weapon in question. In order to become Master of a weapon, the weapon itself must allow for some degree of skill in its use. In order to become a Master, one must be a fighter and already possess both a proficiency and specialisation in the weapon. They must also use the weapon extensively, to the extent that the DM considers it to be their "primary weapon".
So long as the prospective Master meets the above requirements, they may be eligible to become a Master of that weapon. Becoming a Master in a weapon you have specialised in costs an additional proficiency slot. Furthermore, it takes time to learn Mastery of a weapon; the prospective Master may not attain Mastery in a weapon they have been specialised in for less than one year. If they are being trained by a Master in that weapon, then they will be eligible to spend a slot on Mastery after 6 months of this training. If they are teaching themselves, it will take a minimum of 10 months - plus 1 month for every point of Intelligence below 18 the fighter possesses, to a maximum of 20 months at Intelligence 8. Fighters with an INT lower than 8 may not become Masters. A fighter may only ever be a Master of one weapon.
A Weapon Master's bonuses for attack and damage due to specialisation increase to +3/+3. For bows and crossbows, his point-blank bonuses increase to +3/+3 as with melee weapons, and he gains an additional +1 to hit at all other range categories, for a total of +2. Mastery of a firearm grants a +2 bonus to-hit rather than a +1 bonus (still no bonus to damage), and ignores heavy armor at all ranges as though they were firing at a short-range target.
A Master of a ranged weapon may suffer a -6 penalty to-hit in order to fire into a close-quarters engagement without a risk of harming allies as long as the combatants are not grappling.
Beyond the level of the Master is that of the High Master. High Mastery cannot be learnt alone - except in special circumstances, it must be taught by another High Master, and can only be learned by one who has been using their weapon and has been a Master for an extended period of time. As with Mastery, an additional proficiency slot must be spent to attain High Mastery. Achieving High Mastery requires a considerable expenditure of time and effort for the character, and is usually only found in the elite; the masters of world-renowned schools of swordsmanship or the legendary archers of the world. Individual qualification is left to the DM's discrection, but the very baseline is for the character to have been a Master of their chosen weapon (and practicing) for at least 1 year. The training to ascend from Master to High Master is often highly unconventional, and involves a great more than simple practice. Quests, trials of strength and skill, and journeys of self-discovery are not uncommon.
The High Master improves the weapon speed of his chosen weapon by 2 - to a minimum of 1 - whenever he uses it. He also scores critical hits on a roll of a natural 19 or 20. High masters who specialize in bows, crossbows, slings, or firearms gain a new range category: extreme range. For all weapons, extreme range is 1/3 farther than long range. The penalty to-hit for extreme range is -10.
A High Master of a ranged weapon may suffer a -8 penalty to-hit in order to fire into a grapple without a risk of harming allies.
The final attainable stage of proficiency with a weapon is Grand Mastery, a level of expertise attained only by a handful of dedicated warriors throughout the world. As with Mastery and High Mastery, an additional proficiency slot must be spent to achieve Grand Mastery. No guidelines are given here for the criteria to attain Grand Mastery; practitioners are purely individual cases and are amongst the top 0.1% of the world in terms of expertise; great time, wondrous deeds, and mighty quests must surely be achieved before Grand Mastery become an option.
Grand Masters gain one additional attack per round beyond those normally granted for weapon specialisation; for example, a 13th level Grand Master would have a rate of 7/2 - 3 attacks on the first round, and 4 attacks on the 2nd. Furthermore, Grand Masters increase the die type of their chosen weapon when they use it; for example, a longsword goes up from 1d8/1d12 to 1d10/1d20.