Aha! Yes, seems like what I am looking for. It seems BD widget framework leverages this. It has an area called "Expressions" and leaves a blank space. Then it gives the hint:
Enter your expression here. Please use the correct PHP syntax and make sure you know 100% which variables are available in target position. For template position, all template parameters will be accessible but for hook position, only hook parameters will be accessible. Some common used expressions:
$visitor['user_id'] > 0 -- means: show the widget for logged in users only.
XenForo_Template_Helper_Core::callHelper('ismemberof', array($visitor,3)) -- means: show the widget for users of user group #3 only.
Does Xenforo have a list of commonly used expressions?