Bluegiga BGScript blinkylight example
I've got a fair amount of BGScript experience and I have some (semi) documented example scripts here: https://github.com/sureshjoshi/ble113-firmware-examples

As a general statement, using $1 or $2 in those APIs is to get the specific PIN on a PORT. So, you're essentially doing a bitmask. 

$1 is pin 0, $2 is pin 1, $4 is pin 2, etc...

If you want to access multiple pins at once, you would use the appropriate value. E.g. 3 in hex is 0x03 (or $3 in BGScript), which is also 0b00000011, which sets pin 0 and pin 1. 

In the embedded world, you'll need to do a lot more of this: https://en.wikipedia.org/wiki/Mask_%28computing%29

If you look through the documentation of the device you're using, they will specify what the functions of each pin at each port are.