The watchdog is a special device within the PIC that will reset the PIC if it is not prevented. This must be stressed, it is not a case of allowing but preventing.
The watchdog has an associated timer, and when the timer expires the watchdog will reset the CPU. The timer must be continually reset by the executing program to prevent the watchdog resetting the CPU. In general the executable program has a few watchdog reset instructions placed at stratigic places within the code. The placing is chosen so that there is a minimum number of such instructions in the code and they are executed during the normal operation of the program. If the CPU stops operating normally these instructions do not get executed and the CPU is reset.
The period within which two successive watchdog resets must occure is configurable by the executing program, but is generally short (long enough to perform long functions). The exact time should be looked up in the Microchip documentation.
It is generally a bad idea to enable the watchdog while developing programs for the PIC
NOTE: there is a temptation to add a watchdog timer reset instruction to the heartbeat interrupt handler. Doing this is generally a VERY BAD idea because it is possible for the program main line code to stop executing correctly and for the heartbeat interrupt handler to continue to function. This prevents the watchdog from resetting the CPU even thought the software has crashed.