I don't know PICs, but they, like most microcontrollers have timer/counter registers which can be set up as input from a GPIO to up-count those digital pulses on a rising edge, falling edge, or both edges. You need to make sure your processor frequency is higher than your input frequency otherwise you can miss some counts. Also, depending on the size of the counter register, 8, 16, 32 bit, etc you could run into an overflow condition. In that case. You need to trigger an interrupt(ISR) when the counter overflows to maintain the overflow count. For example, In an 8 bit counter register, it will overflow and reset to 0 after 255 pulses have been counted. The counter can trigger an interrupt on an overflow condition and that interrupt routine can simply do something like overflowCount+=1
When you read your total pulse count to the user, you would need to do:totalPulses= counter register value+(255*overflowCount)
I don't know for how long this will count, but you could overflow your counter variable if you don't use a large enough variable type. Maybe use a 64bit Long type.
Read through your PIC's data sheet and you should find an example of a counter.