Apart from the predefined shaders you can write your own shaders for Cycles. They only work for CPU rendering though.
The scripts you see in the text editor are shaders written in the Open Shading Language (OSL). These shaders are small programs written in a C-like language. They are usually used to tell Cycles how to calculate the material color, but can also perform other computations.
The following is a short description of how OSL shaders work. It is not intendet to be a complete tutorial, and you should have at least basic programming skills. Also it has been a while since I played around with OSL shaders, so if anyone finds a mistake in my description please let me know.
Using an OSL Shader:
To use a OSL shader, you have to add a script node to your Cycles material which is set to the .osl script. You can add a script node by pressing Shift+A and selecting Script->Script from the menu. This node can be set to use an internal shader (one from Blender's text editor) or an external shader file (an .osl file on your hard drive). The inputs and outputs of this node are generated automatically from the shader code.
Structure of an OSL Shader:
An OSL shader can contain typical C-style functions and preprocessor directives.
The actual shader program in the .osl script is the function that begins with the keyword
shader. The name of the shader function is arbitrary, but only one shader function is allowed per file.
Between the opening and closing bracket after the function's name comes a list of input and output variables. Each variable is declared using a type (e.g.
color), its name (e.g.
Color_Diffuse) and a default value (e.g. 0.5) which is used when no input is connected to this slot of the script node . In addition to that, a variable declaration can be preceded by the keyword
output. These variables will appear as output sockets on the right side of the script node, all other variables are inputs. Outputs can be written to, inputs can only be read. Each OSL shader should have at least one output, otherwise its computations can not be used.
Apart from the user-supplied inputs an OSL shader can also use some functions and variables provided by Blender, most notably closures. Closures allow you to access the functionality of the normal Cycles shader nodes. See the documentation for a list of these functions. In the screenshot you posted the
emission closure are used to calculate the output closure named
BSDF, which determines the color of your material when it is connected to the 'Surface' input of the 'Material Output' node.
If you want to see some other shader examples click on the 'Templates' button in Blender's text editor, then select 'Open Shading Language' and select a template that sounds interesting.
Unfortunatly I do not know any good beginner tutorials, but you can have a look at this one which describes how to translate a GLSL shader into a OSL shader and this one which describes how to create an absorption shader.
Otherwise I advise you to just try it out. Learning by doing usualy gives you the most benefit when programming.