Shadow Cloak
Activation: — and immediate (command)
The information above is pulled directly from the items info. We see that it takes an immediate action to activate either of its command effects.
For reference,
Swift Action
A swift action consumes a very small amount of time, but represents a larger expenditure of effort and energy than a free action. You can perform only a single swift action per turn.
Immediate Action
An immediate action is very similar to a swift action, but can be performed at any time — even if it's not your turn.
The information on the Cloak states
If you are attacked, you can use the cloak three times per day to produce one or the other of the following effects. You can gain concealment for 1 round, or you can teleport to a space you can see clearly up to 10 feet in any direction.
So it only works against an action defined as an attack. As such you need to decide what exactly a grapple is considered to be.
http://www.d20srd.org/srd/combat/actionsInCombat.htm
Has Grapples listed under its miscellaneous actions Table near the bottom of the page.
The note connected to it says
- These attack forms substitute for a melee attack, not an action. As melee attacks, they can be used once in an attack or charge action, one or more times in a full attack action, or even as an attack of opportunity.
So Grapples according to the SRD are defined as Melee Attack Actions. As such...
The Shadow Cloak would allow you to escape from a grapple attempt. It cannot however be used to escape from within an already successfully established Grapple.