Like, when i'm in the uv tab. I would like my mouse 4 button to mark seams. In modeling tab, i would like it to idk, add bevels or something else.
How can i make it do two separate things in different tabs ?
In Blender hotkeys are devided in areas, that you can see in the User Preferences.
While your mouse is hovering over a certain area (for example the 3D Viewport or the UV Editor), that area is the active one, and when you press a button it will use the command of that specific area.
For example, when you press Alt + P, if your mouse is in a 3D View window, it will bring up the Clear Parent menu, while if it is in the Text Editor it will execute the Run Script command.
To change an hotkey for a specific window (let's say the UV Editor) you need to go in the User Preferences>Keymap>Image>UV Editor and modify/add your hotkey.
In your question you mention the "modeling tab", so you are speaking of the Workspaces in Blender. These are just different ways to arrange the different windows/panels in the UI, they are not different sections of the software: a 3D Viewport is the same in all workspaces, therefore all hotkeys will remain the same across different workspaces