-what is the SWF fileBasically a whole game in one file. Flash Player games all come in .swf files.
-what is the point from it to use it in the downloaded pb2 gameExecutable file does need .swf file to run game. Executable file is actually just a standalone Flash Player that does not require any plugins installed and should just work once downloaded.
-how it worksThis page might be more detailed on any questions related to format itself.
https://en.wikipedia.org/wiki/SWF-is it the file saving the campaign progress or it's useful used to change any sprites you want.It is basically everything in case with PB2. Game progress though isn't saved in game folder (instead it will be kept at default location for Flash Player's localStorage at user's platform. So it can be different for OS X/Windows users).
-is that SWF file harmful?.swf file of PB2 isn't harmful. It is actually exactly same file that is used to play game in browser. Generally some of .swf files could be (according to some loud news regarding Flash Player) harmful, but only if they were made in specific software and in specific way. I actually started making games for Flash Player back in the days because Flash games could have enough features to make them feel like proper PC games but would be much more trusted than .exe games from Internet out there. To be fair, there is not much popular software that never had vulnerabilities for some period of time. It is just in case of Flash Player some of them were not patched quickly (this is where from whole "Flash Player is harmful" thing comes from).
- why it appears with a warning that this file is harmful?I don't know really. What software gives you such warning? I don't recall encountering anything like that on any of my systems where I tested PB2. Usually Windows might always try to warn about .exe files downloaded from Internet, but that is about it. Files of extension .exe are executable files. Basically they can interact with your system in almost any way. They can be fine or they can be harmful, depends on who made specific .exe file. Any application you use for Windows including web browser comes in .exe file.
- if this file is harmful, it will harm my computer?Depends on intention of whoever makes the file. Files from this website are secure. I believe considering how popular this game is - there would be cases of people proving it wrong in details at this point during all years of its existence.
-is it legal to use it for modding the game?As long as modification does not tries to have multiplayer mode with unfair advantages - I'm usually fine with it. For extra safety though it is best to disable multiplayer mode completely in any modification (usually it is done automatically).
-what the EXE file?.exe is executable. Any software comes into these (Windows only).
-why the EXE file will appear with the game, unlike the SWF file?.exe is standalone Flash Player projector. .swf is game itself (same file used to run game in browser). They both come just so there won't be need to install Flash Player especially when Adobe will stop supporting its' development.
-why is the point from the SWF file if you can find it on the EXE file?.swf file was useful for redistribution. Since it is same file that would go to Flash games portals. Also, in case if somebody would find .swf file enough considering they have Flash Player installed in their system.
-I have seen that some people are not from staff and they mod the game, like cakespider,
do they use the SWF file or something else?Yes. As long as modification does not tries to have multiplayer mode with unfair advantages - I'm usually fine with it. For extra safety though it is best to disable multiplayer mode completely in any modification (usually it is done automatically).