You will need some sort of multmeter and some jumper leads with clips on the ends. You also should have a wiring diagram....which is in the back pages of the owner's manual. Go to the Honda Marine website and used your frame serial number to determine which is your manual.
http://marine.honda.com/support/manuals/models/BF40
First check for constant 12v to the gauge by checking the voltage from the ground terminal to the positive or ignition terminal on the gauge. Meter should be on DC volts. If the voltage stays constant while the tach jumps around, then move to the next test. If it jumps around too, then you probably have a loose connection in the grounding or 12 v wiring to the gauge. Also check to see if the actual voltage is above 12v ....in indicate that the charging system is working ok.
I suggest checking the charging, since the charge coils provide voltage to the regulator/rectifier to charge the battery. The signal lead to the tachometer (grey lead) comes from the reg/rect to the tachometer through several connectors. The wiring diagram shows all of these connectors.
If 12v is constant, then connect the meter between the ground terminal and the signal terminal on the back of the tach. The meter should be on AC volts. The voltage should be a constant 5 volts or more. It will probably vary with the speed of the motor, but should not jump on and off, like your tach is.
If the signal voltage jumps around, then you will need to find the grey lead (signal lead) back at the engine. Easiest place is where all the wires cross connect under the plastic cover on the port side of the engine. You could follow the grey wire all the way back, but if you go right to the engine and the meter stays constant at the engine, then you know the problem is in the wiring somewhere between the motor and the gauge. Then you have to just trace along the grey wire from connector to connector to see where the problem is. Could just be a pushed out pin in a connector or corrosion on a pin in one of the connectors. It could also be a broken wire inside the insulation (which could be a real bear to find).
Get yourself a longer wire to connect to a good engine ground to run to the ground wire on your meter. Then you just have to move your positive probe to the various points along the path of the grey lead. Pull the connectors apart and check the pins and connectors to which the grey lead is attached.
If the voltage jumps around when you test at the engine and all connectors between the rectifier and the charge coils are good, you may have an issue with the reg/rect or charge coils.
If you hear a high pitched noise from under the flywheel, then one of your coils on the flywheel may be coming delaminated and rubbing up against the charge coil...possibly causing an intermittent issue.
Whew! As I read back through that, I hope you have at least some electric trouble shooting experience. It certainly is not a perfect troubleshooting guide, but it should at least get you started. I hope I did not discourage you with the rambling...
The wiring diagram is your road map...so be sure to use it.
As you can see, there are many things that it could be. It could turn out to be very simple or could be a bit more complicated.
Just take your time...and have a lot of patience. No beer until you find the problem. LOL
Mike