In order to customize weapons, you need to build the gunsmith bench. If you started the game recently, then this table will need to be built during one of the tasks of the Survivor's Path. Then you’ll have to find a blueprint, learn it and then craft the modification. Every weapon has a slot for modified parts. Having chosen a slot, you can place one of modifications in there. Depending on the weapon, the number of slots may differ.