“beforefirstenter” is a script attribute. It is run the first time that a player enters an object (room), before the room description is printed.
Quest keeps track of whether a room has been visited before by checking the value of the visited attribute.
See also firstenter, enter, visited.