Not sure if there are guidelines for providing callback functionnality. It's more like a design-pattern :
http://en.wikipedia.org/wiki/Callback_(computer_science)
When you are coding a library and you want to provide the ability to execute custom codes on some events, you use callbacks. In Processing, it's just a function that will be called by the library when some events occur.
For example, proMidi will call
noteOn() when a note is played. SoundCypher will call your
handleCallbacks() method when it reaches a previously registered callback. You could think of the core UI methods -
mouseClicked(),
keyPressed(), etc. - as callbacks too (methods call by Processing's core on mouse or keyboard events).
To provide a callback, you just need to make sure that the method you will call does exist. There is a how-to on the wiki :
Library Basics > Adding Your Own Library Events