Your charger cables are fused within 7" of each battery terminal, which is what you want. The charger can develop a dead short and you'll just blow a fuse with no risk to you or the boat. [thumbs up]
What is the make and model of the new charger? Take a look at the owners manual and somewhere it will tell the max output per battery. That's what you need to find.
While saying it will put out 40A is good marketing (bigger numbers are always better) it would be pretty uncommon to hit a 12V battery with 40A so my guess is that it'll top at 20 per battery. IF IF IF that's indeed the case, the existing fuses ought to work (maybe nuisance trip though) till you swap each for a 30A.
In doing so, you should get rid of the existing yellow fuse holders because the wires are too thin for 30A. It looks like the red charger cables are 10 AWG and the yellow fuse holder wires are maybe 12 or 14 AWG, so only rated for 25A and 20A respectively.
You could splice in similar fuse holders made with 10AWG wire or simply put in a couple of <$6 terminal fuses like these and eliminate two splices which could corrode over time:
(btw - Annapolis-based PKYS is just a couple of guys who always have great prices and have become my go-to for this kind of stuff. Michael always answers the phone.)
The yellow Xantrex dongle looks like another fuse holder of the type used for little AC inverters. Re-arrange the attachments to that post so the heavy copper lug currently on top is on the bottom. Check the red 14-ish AWG wire at the left edge of the photo to make sure it is fused.
Then get some red rubber caps for each of the + battery terminals before you drop a wrench in there. Like I'd do. I'm going to assume you have the battery hold-down straps removed for maintenance or the photo.