Buddypress function and global $bp question

Plugins load alphabetically by default. If Buddypress is alphbetically before your plugins folder name, then Buddypress will load first and it’s functions will be available. Additionally, whatever functionality depends on another plugins you can always attach to the plugins_loaded hook, which fires after all plugins are finished loading. For example:

/**
 * Runs code after plugins have finished loading
 *
 * @return void
 */
function prefix_plugins_loaded() {

    die( 'Plugins have finished loading.' );

}
add_action( 'plugins_loaded', 'prefix_plugins_loaded' );

PHP Globals are common in Plugins and WordPress. The $bp global is simply a variable that likely holds a required object needed by the specific plugin function.