In their latest Blog post, the Battlefield 3 team reveal that there are thousands of weapon customization options.
In the post they explain that each main weapon has three accessory slots, where you can attach weapon accessories you have unlocked. To unlock these you simply need to use a weapon, use it enough and you unlock the option to customize that weapon to fit different your combat role and play style.
For example, a rifle in Battlefield 3 can be customized for wildly different combat roles. The carbine can be equipped with a heavy barrel, bipod, and a 4X magnification combat scope. This would be ideal for a soldier who wants to engage targets at medium to long range and use suppressive fire to support his team mates.
In a different configutation, the same carbine can be equipped with a suppressor, foregrip, and quick acquisition holographic scope. This setup would be well suited for Close Quarters Battle, especially indoors where stealth can be a vital factor.